﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        protected NeedleIndicator SetNeedleIndicator(NeedleIndicator needleIndicator)
        {
            needleIndicator.BorderBrush = NeedleBorderBrush==null? null : NeedleBorderBrush.Brush;
            needleIndicator.BorderThickness = NeedleBorderThickness;
            needleIndicator.Background = NeedleBackground==null? null : NeedleBackground.Brush;
            needleIndicator.CapBackground = NeedleCapBackground==null? null : NeedleCapBackground.Brush;
            needleIndicator.LabelBackground = NeedleLabelBackground==null? null : NeedleLabelBackground.Brush;
            needleIndicator.LabelEnabled = NeedleLabelEnabled;
            needleIndicator.LabelFontColor = NeedleLabelFontColor==null? null : NeedleLabelFontColor.Brush;
            needleIndicator.LabelFontFamily = NeedleLabelFontFamily;
            needleIndicator.LabelFontWeight = NeedleLabelFontWeight;
            needleIndicator.LabelStyle = NeedleLabelStyle;
            needleIndicator.Placement = NeedlePlacement;
            needleIndicator.ShadowEnabled = NeedleShadowEnabled;
            needleIndicator.ToolTipText = NeedleToolTipText;


            needleIndicator.CapWidth = NeedleCapWidth ?? 0.3;
            needleIndicator.DistanceFromScale = NeedleDistanceFromScale;
            needleIndicator.IndicatorWidth = NeedleIndicatorWidth ?? 0.15;
            return needleIndicator;
        }
        private BrushEx needleBorderBrush;
        private Thickness needleBorderThickness;
        private BrushEx needleBackground;
        private BrushEx needleCapBackground;
        private BrushEx needleLabelBackground;
        private bool needleLabelEnabled;
        private BrushEx needleLabelFontColor;
        private FontFamily needleLabelFontFamily;
        private FontWeight needleLabelFontWeight;
        private LabelStyles needleLabelStyle;
        private PlacementTypes needlePlacement;
        private bool needleShadowEnabled;
        private string needleToolTipText;


        private double? needleCapWidth;
        private double needleDistanceFromScale;
        private double? needleIndicatorWidth;

        [Category("指针")]
        [DisplayName("指针边框颜色")]
        [Description("NeedleBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleBorderBrush", "指针边框颜色")]
        public BrushEx NeedleBorderBrush
        {
            get
            {
                return needleBorderBrush;
            }

            set
            {
                needleBorderBrush = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针边框大小")]
        [Description("NeedleBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleBorderThickness", "指针边框大小")]
        public Thickness NeedleBorderThickness
        {
            get
            {
                return needleBorderThickness;
            }

            set
            {
                needleBorderThickness = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针背景颜色")]
        [Description("NeedleBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleBackground", "指针背景颜色")]
        public BrushEx NeedleBackground
        {
            get
            {
                return needleBackground;
            }

            set
            {
                needleBackground = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针盖帽背景颜色")]
        [Description("NeedleCapBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleCapBackground", "指针盖帽背景颜色")]
        public BrushEx NeedleCapBackground
        {
            get
            {
                return needleCapBackground;
            }

            set
            {
                needleCapBackground = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针标签背景颜色")]
        [Description("NeedleLabelBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleLabelBackground", "指针标签背景颜色")]
        public BrushEx NeedleLabelBackground
        {
            get
            {
                return needleLabelBackground;
            }

            set
            {
                needleLabelBackground = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针标签是否可用")]
        [Description("NeedleLabelEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleLabelEnabled", "指针标签是否可用")]
        public bool NeedleLabelEnabled
        {
            get
            {
                return needleLabelEnabled;
            }

            set
            {
                needleLabelEnabled = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针标签字体颜色")]
        [Description("NeedleLabelFontColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleLabelFontColor", "指针标签字体颜色")]
        public BrushEx NeedleLabelFontColor
        {
            get
            {
                return needleLabelFontColor;
            }

            set
            {
                needleLabelFontColor = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针标签字体")]
        [Description("NeedleLabelFontFamily")]
        [Editor(typeof(UI.XProperty.Editors.XFontFamilyEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleLabelFontFamily", "指针标签字体")]
        public FontFamily NeedleLabelFontFamily
        {
            get
            {
                return needleLabelFontFamily;
            }

            set
            {
                needleLabelFontFamily = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针标签字体粗细")]
        [Description("NeedleLabelFontWeight")]
        [Editor(typeof(UI.XProperty.Editors.XFontWeightEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleLabelFontWeight", "指针标签字体粗细")]
        public FontWeight NeedleLabelFontWeight
        {
            get
            {
                return needleLabelFontWeight;
            }

            set
            {
                needleLabelFontWeight = value;
                Refresh();
            }
        }

        public LabelStyles NeedleLabelStyle
        {
            get
            {
                return needleLabelStyle;
            }

            set
            {
                needleLabelStyle = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针位置")]
        [Description("NeedlePlacement")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XPlacementTypesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedlePlacement", "指针位置")]
        public PlacementTypes NeedlePlacement
        {
            get
            {
                return needlePlacement;
            }

            set
            {
                needlePlacement = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针是否显示阴影")]
        [Description("NeedleShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleShadowEnabled", "指针是否显示阴影")]
        public bool NeedleShadowEnabled
        {
            get
            {
                return needleShadowEnabled;
            }

            set
            {
                needleShadowEnabled = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针提示")]
        [Description("NeedleToolTipText")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleToolTipText", "指针提示")]
        public string NeedleToolTipText
        {
            get
            {
                return needleToolTipText;
            }

            set
            {
                needleToolTipText = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针盖帽大小(0-1)")]
        [Description("NeedleCapWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleCapWidth", "指针盖帽大小(0-1)")]
        public double? NeedleCapWidth
        {
            get
            {
                return needleCapWidth;
            }

            set
            {
                needleCapWidth = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针距离标尺距离(0-1)")]
        [Description("NeedleDistanceFromScale")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleDistanceFromScale", "指针距离标尺距离(0-1)")]
        public double NeedleDistanceFromScale
        {
            get
            {
                return needleDistanceFromScale;
            }

            set
            {
                needleDistanceFromScale = value;
                Refresh();
            }
        }

        [Category("指针")]
        [DisplayName("指针宽度(0-1)")]
        [Description("NeedleIndicatorWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "NeedleIndicatorWidth", "指针宽度(0-1)")]
        public double? NeedleIndicatorWidth
        {
            get
            {
                return needleIndicatorWidth;
            }

            set
            {
                needleIndicatorWidth = value;
                Refresh();
            }
        }
    }
}
